package com.xpsoft.core.sms;

import com.jasson.mas.api.ApiException;
import com.jasson.mas.api.sms.SmsApiClient;
import com.jasson.mas.api.sms.SmsApiClientHandler;
import com.jasson.mas.api.sms.SmsApiClientImpl;

public class SmsClientStart {
	public static void SMSConnent() {
		SmsApiClient smsApiClient = null;

		//String appID = "YHMAS";// API组件标识ID
		//String appPwd = "123456";// API组件密码
		
		/**
         * 开发测试用
         * */
        String appID = "yhoatest";// API组件标识ID
		String appPwd = "yhoatest";// API组件密码
		
		int masApiPort = 61616;//端口
		String emaIP = "58.210.126.158";//IP

		SmsApiClientHandler smsHandler = new SmsAPIClientHandlerImpl();
		try {
			smsApiClient = new SmsApiClientImpl(smsHandler, emaIP, masApiPort,appID, appPwd);
			smsApiClient.setAutoConnect(true);
			smsApiClient.setReConnectInterval(60);
			smsApiClient.setConnectTimeout(100000);
			smsApiClient.setSendTimeout(1000000);
			smsApiClient.start();
		} catch (ApiException e) {
			e.printStackTrace();
		}
	}
}
